package controller;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Parsing query statement.
 * 
 * @author Stanley
 * 
 */
public class QueryParser {
	private String query;

	/**
	 * constructor with query 
	 * @param query  query statement
	 */
	public QueryParser(String query) {
		super();
		this.query = query;
	}

	// Pattern p =
	// Pattern.compile("\\s*(?i)select\\s+([^\\s~!@#$%%^\\*]+|\\*)\\s+(?i)from\\s*[^\\s~!@#$%%^]+");
	// Matcher m = p.matcher("select *a from a");
	// Pattern p1 =
	// Pattern.compile("\\s*(?i)select\\s+([^\\s~!@#$%%^\\*]+|\\*)\\s+(?i)from\\s*");
	// String[] a = p1.split("select *       from abc");
	// boolean result = m.matches();
	// System.out.println(a[1]);

	public boolean isSelectStatement() {
		String pattern = "\\s*(i)SELECT\\s+([^\\s~!@#$%^&*<>/]+|\\*)\\s+(?ifrom)";
		Pattern p = Pattern.compile(query);
		Matcher m = p.matcher(query);
		return false;
	}

	public boolean isCreateDatabaseStatement() {
		return false;
	}

	public boolean isCreateTableStatement() {
		return false;
	}

	public boolean isInsertStatement() {
		return false;
	}

	public boolean isUpdateStatement() {
		return false;
	}

	public boolean isDeleteStatement() {
		return false;
	}

}
